<template>
  <div class="row q-px-sm">
    <div class="col-md-2 col-xs-12 q-px-sm">
      <q-card class="bg-white my-card">
        <q-card-section class="text-center">
          <q-avatar rounded size="100px">
            <q-img :src="userInfo.headerImg"></q-img>
          </q-avatar>
          <q-item-label class="q-my-sm"
            ><strong>{{ userInfo.nickName }}</strong></q-item-label
          >
          <q-item-label>{{ userInfo.userName }}</q-item-label>
          <div
            class="row text-left q-mt-lg text-body2 text-grey-9"
            style="margin: 0 auto; width: 120px; margin-top: 24px"
          >
            <q-item-label class="col-12">
              <q-icon name="home" color="grey-9" size="16px" class="q-mr-xs" />
              {{ userInfo.company }}
            </q-item-label>
            <q-item-label class="col-12">
              <q-icon
                name="admin_panel_settings"
                color="grey-9"
                size="16px"
                class="q-mr-xs"
              />
              {{ userInfo.roles == '7' ? '系统管理员' : '员工' }}
            </q-item-label>
            <q-item-label class="col-12">
              <q-icon
                name="person_pin"
                color="grey-9"
                size="16px"
                class="q-mr-xs"
              />
              {{ userInfo.posttype }}
            </q-item-label>
          </div>
        </q-card-section>
      </q-card>
      <!-- <q-separator inset="" /> -->

      <q-card
        class="bg-white my-card"
        style="margin-top: 10px;"
      >
        <q-card-section>
          <q-item-label class="text-body1">所属公司</q-item-label>
          <q-item-label class="q-gutter-sm">
            <q-chip
              size="14px"
              color="white"
              :key="index"
              v-for="(item, index) in customeruser"
            >
              <q-avatar size="md">
                <q-img :src="item.logoimg" />
              </q-avatar>
              {{ item.company }}
            </q-chip>
          </q-item-label>
        </q-card-section>
      </q-card>
    </div>
    <div class="col-md-10 col-xs-12 q-px-sm">
      <q-card class="my-card">
        <q-card-section class="col-sm-9 col-xs-8 q-px-none">
          <q-tabs
            v-model="centerTab"
            class="bg-white"
            active-color="primary"
            indicator-color="primary"
            align="left"
            content-class="text-grey-9"
            narrow-indicator
          >
            <q-tab name="focus" @click="getfollow">
              <span> <q-icon name="center_focus_strong" size="sm" />关注 </span>
            </q-tab>
            <q-tab name="collect" @click="change('collect')">
              <span>
                <q-icon name="star" size="sm" />
                收藏
              </span>
            </q-tab>
            <q-tab name="identity" @click="getfollows">
              <span>
                <q-icon name="perm_identity" size="sm" />
                粉丝
              </span>
            </q-tab>
            <q-tab name="likes" @click="change('likes')">
              <span>
                <q-icon name="favorite" size="sm" />
                点赞
              </span>
            </q-tab>

            <q-tab name="reading" @click="change('reading')">
              <span> <q-icon name="history" size="sm" />浏览记录 </span>
            </q-tab>
            <q-tab name="audit" @click="change('audit')">
              <span> <q-icon name="home" size="sm" />我的发布 </span>
            </q-tab>
          </q-tabs>
        </q-card-section>
      </q-card>
      <!-- <q-separator /> -->
      <q-tab-panels
        v-model="centerTab"
        animated
        transition-prev="fade"
        transition-next="fade"
        style="background: none"
      >
         <q-tab-panel name="audit" class="q-pt-none" style="padding: 0">
          <sc-page
            class="q-mt-sm"
            :items="auditlist"
            :perNumber="pagesize"
            :datacounts="datacount"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
            item-class="q-pa-sm col-xl-3 col-lg-3 col-md-4 col-sm-6 col-xs-12 "
          >
            <template v-slot:item="props">
              <div class="q-pb-sm">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-item-section>
                        <q-item-label class="text-body1 q-mb-sm">
                          <strong> {{ props.item.title }} </strong>
                        </q-item-label>
                        <q-item-label
                          style="
                            height: 66px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <q-item-label
                            class="q-mb-sm"
                            v-show="props.item.pjpp"
                          >
                            <q-chip
                              :label="props.item.pjpp"
                              class="cursor-pointer"
                              color="primary"
                              text-color="white"
                              square
                              size="12px"
                            ></q-chip>
                          </q-item-label>
                          <p class="text-grey-8 q-mb-sm q-pl-xs line">
                            {{ props.item.body }}
                          </p>
                        </q-item-label>
                        <q-item-label
                          class="row text-body2 text-grey-7 items-center q-gutter-x-xs"
                          style="
                            display: flex;
                            flex-direction: column;
                            align-items: flex-start;
                          "
                        >
                          <q-chip
                            color="white"
                            text-color="primary"
                            class="col-auto cursor-pointer"
                          >
                            <q-avatar size="30px">
                              <img :src="props.item.logoimg" />
                            </q-avatar>
                            <span
                              class="col-auto text-primary cursor-pointer"
                              >{{ props.item.company }}</span
                            >
                          </q-chip>
                        </q-item-label>
                        <q-separator spaced="10px" />
                        <div
                          class="q-mt-sm row items-center"
                          style="
                            height: 24px;
                            display: flex;
                            justify-content: space-between;
                          "
                        >
                          <span class="col-sm-auto col-xs-12 q-pl-xs">
                            {{ props.item.nowdate }}
                          </span>
                          <q-btn-group flat>
                            <q-btn
                              flat
                              dense
                              icon="delete_forever"
                              :label="props.item.collection"
                              size="12px"
                              class="q-mr-sm"
                              color="red"
                            >
                              <q-tooltip>删除</q-tooltip>
                            </q-btn>
                            <!-- <q-separator vertical /> -->
                          
                          </q-btn-group>
                        </div>
                      </q-item-section>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </div>
            </template>
          </sc-page>
        </q-tab-panel>
        <q-tab-panel name="collect" class="q-pt-none" style="padding: 0">
          <sc-page
            class="q-mt-sm"
            :items="collectlist"
            :perNumber="pagesize"
            :datacounts="datacount"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
            item-class="q-pa-sm col-xl-3 col-lg-3 col-md-4 col-sm-6 col-xs-12 "
          >
            <template v-slot:item="props">
              <div class="q-pb-sm">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-item-section>
                        <q-item-label class="text-body1 q-mb-sm">
                          <strong> {{ props.item.title }} </strong>
                        </q-item-label>
                        <q-item-label
                          style="
                            height: 66px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <q-item-label
                            class="q-mb-sm"
                            v-show="props.item.pjpp"
                          >
                            <q-chip
                              :label="props.item.pjpp"
                              class="cursor-pointer"
                              color="primary"
                              text-color="white"
                              square
                              size="12px"
                            ></q-chip>
                          </q-item-label>
                          <p class="text-grey-8 q-mb-sm q-pl-xs line">
                            {{ props.item.body }}
                          </p>
                        </q-item-label>
                        <q-item-label
                          class="row text-body2 text-grey-7 items-center q-gutter-x-xs"
                          style="
                            display: flex;
                            flex-direction: column;
                            align-items: flex-start;
                          "
                        >
                          <q-chip
                            color="white"
                            text-color="primary"
                            class="col-auto cursor-pointer"
                          >
                            <q-avatar size="30px">
                              <img :src="props.item.logoimg" />
                            </q-avatar>
                            <span
                              class="col-auto text-primary cursor-pointer"
                              >{{ props.item.company }}</span
                            >
                          </q-chip>
                        </q-item-label>
                        <q-separator spaced="10px" />
                        <div
                          class="q-mt-sm row items-center"
                          style="
                            height: 24px;
                            display: flex;
                            justify-content: space-between;
                          "
                        >
                          <span class="col-sm-auto col-xs-12 q-pl-xs">
                            {{ props.item.nowdate }}
                          </span>
                          <q-btn-group flat>
                            <q-btn
                              flat
                              dense
                              icon="delete_forever"
                              :label="props.item.collection"
                              size="12px"
                              class="q-mr-sm"
                              color="red"
                            >
                              <q-tooltip>删除</q-tooltip>
                            </q-btn>
                            <!-- <q-separator vertical /> -->
                       
                          </q-btn-group>
                        </div>
                      </q-item-section>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </div>
            </template>
          </sc-page>
        </q-tab-panel>
        <q-tab-panel name="likes" class="q-px-sm q-pt-none" style="padding: 0">
          <sc-page
            :items="likeslist"
            :perNumber="pagesize"
            :datacounts="datacount"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
            item-class="col-xl-3 col-lg-3 col-md-4 col-sm-6 col-xs-12"
          >
            <template v-slot:item="props">
              <div class="q-pb-sm">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-item-section>
                        <q-item-label class="text-body1 q-mb-sm">
                          <strong> {{ props.item.title }} </strong>
                        </q-item-label>
                        <q-item-label
                          style="
                            height: 66px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <q-item-label
                            class="q-mb-sm"
                            v-show="props.item.pjpp"
                          >
                            <q-chip
                              :label="props.item.pjpp"
                              class="cursor-pointer"
                              color="primary"
                              text-color="white"
                              square
                              size="12px"
                            ></q-chip>
                          </q-item-label>
                          <p class="text-grey-8 q-mb-sm q-pl-xs line">
                            {{ props.item.body }}
                          </p>
                        </q-item-label>
                        <q-item-label
                          class="row text-body2 text-grey-7 items-center q-gutter-x-xs"
                          style="
                            display: flex;
                            flex-direction: column;
                            align-items: flex-start;
                          "
                        >
                          <q-chip
                            color="white"
                            text-color="primary"
                            class="col-auto cursor-pointer"
                          >
                            <q-avatar size="30px">
                              <img :src="props.item.logoimg" />
                            </q-avatar>
                            <span
                              class="col-auto text-primary cursor-pointer"
                              >{{ props.item.company }}</span
                            >
                          </q-chip>
                        </q-item-label>
                        <q-separator spaced="10px" />
                        <div
                          class="q-mt-sm row items-center"
                          style="
                            height: 24px;
                            display: flex;
                            justify-content: space-between;
                          "
                        >
                          <span class="col-sm-auto col-xs-12 q-pl-xs">
                            {{ props.item.nowdate }}
                          </span>
                          <q-btn-group flat>
                            <q-btn
                              flat
                              dense
                              icon="delete_forever"
                              :label="props.item.collection"
                              size="12px"
                              class="q-mr-sm"
                              color="red"
                            >
                              <q-tooltip>删除</q-tooltip>
                            </q-btn>
                            <!-- <q-separator vertical /> -->
                            <!-- <q-btn
                              flat
                              dense
                              icon="qr_code"
                              :label="props.item.star"
                              size="12px"
                              color="grey-8"
                              class="q-mx-sm"
                              @click="
                                getqrcode(props.item.infortype, props.item.id)
                              "
                            >
                              <q-tooltip>小程序码</q-tooltip>
                            </q-btn> -->
                          </q-btn-group>
                        </div>
                      </q-item-section>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </div>
            </template>
          </sc-page>
        </q-tab-panel>
         <q-tab-panel name="identity" class="q-pt-none" style="padding: 0">
          <sc-page
            :items="followslist"
            class="q-mt-sm"
            item-class="col-xl-3 col-sm-4 col-xs-12"
            :datacounts="datacount"
            :perNumber="pagesize"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
          >
            <template v-slot:item="props">
              <q-intersection once transition="scale">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-img
                        :src="props.item.mdimg"
                        :ratio="16 / 10"
                        v-if="props.item.mdimg"
                      />
                      <q-img
                        :src="props.item.logoimg"
                        :ratio="16 / 10"
                        v-else
                      />
                      <q-list class="q-mt-md">
                        <q-item
                          dense
                          class="text-body1 text-center"
                          style="display: flex; justify-content: center"
                        >
                          <strong>{{ props.item.company }}</strong>
                        </q-item>
                      </q-list>
                      <q-separator />
                      <q-item class="q-px-sm">
                        <q-btn-group flat spread class="full-width">
                          <q-btn
                            flat
                            dense
                            icon="delete_forever"
                            size="sm"
                            class="q-mr-sm"
                            color="red"
                            @click="opfollow(props.item.guestcode)"
                          >
                            <q-tooltip>取消关注</q-tooltip>
                          </q-btn>
                          <!-- <q-separator vertical inset="" /> -->
                     
                          <!-- <q-separator vertical inset="" /> -->
                          <q-btn
                            flat
                            dense
                            icon="share"
                            size="sm"
                            color="grey-6"
                            class="q-mx-sm"
                          >
                            <q-tooltip>分享</q-tooltip>
                          </q-btn>
                        </q-btn-group>
                      </q-item>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </q-intersection>
            </template>
          </sc-page>
        </q-tab-panel>
        <q-tab-panel name="focus" class="q-pt-none" style="padding: 0">
          <sc-page
            :items="followlist"
            class="q-mt-sm"
            item-class="col-xl-3 col-sm-4 col-xs-12"
            :datacounts="datacount"
            :perNumber="pagesize"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
          >
            <template v-slot:item="props">
              <q-intersection once transition="scale">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-img
                        :src="props.item.mdimg"
                        :ratio="16 / 10"
                        v-if="props.item.mdimg"
                      />
                      <q-img
                        :src="props.item.logoimg"
                        :ratio="16 / 10"
                        v-else
                      />
                      <q-list class="q-mt-md">
                        <q-item
                          dense
                          class="text-body1 text-center"
                          style="display: flex; justify-content: center"
                        >
                          <strong>{{ props.item.company }}</strong>
                        </q-item>
                      </q-list>
                      <q-separator />
                      <q-item class="q-px-sm">
                        <q-btn-group flat spread class="full-width">
                          <q-btn
                            flat
                            dense
                            icon="delete_forever"
                            size="sm"
                             class="q-mx-sm"
                            color="red"
                            @click="opfollow(props.item.guestcode)"
                          >
                            <q-tooltip>取消关注</q-tooltip>
                          </q-btn>
                          <!-- <q-separator vertical inset="" /> -->
                        
                          <!-- <q-separator vertical inset="" /> -->
                          <q-btn
                            flat
                            dense
                            icon="share"
                            size="sm"
                            color="grey-6"
                            class="q-mx-sm"
                          >
                            <q-tooltip>分享</q-tooltip>
                          </q-btn>
                        </q-btn-group>
                      </q-item>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </q-intersection>
            </template>
          </sc-page>
        </q-tab-panel>
        <q-tab-panel name="reading" class="q-px-sm q-pt-none" style="padding: 0">
          <sc-page
            :items="readinglist"
            item-class="col-xl-3 col-lg-3 col-md-4 col-sm-6 col-xs-12"
            :perNumber="pagesize"
            :datacounts="datacount"
            @ChangeCurrentPage="ChangeCurrentPage"
            @ChangeInputPagePage="ChangeInputPagePage"
          >
            <template v-slot:item="props">
              <div class="q-pb-sm">
                <sc-shadow>
                  <q-card class="my-card">
                    <q-card-section>
                      <q-item-section>
                        <q-item-label class="text-body1 q-mb-sm">
                          <strong> {{ props.item.title }} </strong>
                        </q-item-label>
                        <q-item-label
                          style="
                            height: 66px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <q-item-label
                            class="q-mb-sm"
                            v-show="props.item.pjpp"
                          >
                            <q-chip
                              :label="props.item.pjpp"
                              class="cursor-pointer"
                              color="primary"
                              text-color="white"
                              square
                              size="12px"
                            ></q-chip>
                          </q-item-label>
                          <p class="text-grey-8 q-mb-sm q-pl-xs line">
                            {{ props.item.body }}
                          </p>
                        </q-item-label>
                        <q-item-label
                          class="row text-body2 text-grey-7 items-center q-gutter-x-xs"
                          style="
                            display: flex;
                            flex-direction: column;
                            align-items: flex-start;
                          "
                        >
                          <q-chip
                            color="white"
                            text-color="primary"
                            class="col-auto cursor-pointer"
                          >
                            <q-avatar size="30px">
                              <img :src="props.item.logoimg" />
                            </q-avatar>
                            <span
                              class="col-auto text-primary cursor-pointer"
                              >{{ props.item.company }}</span
                            >
                          </q-chip>
                        </q-item-label>
                        <q-separator spaced="10px" />
                        <div
                          class="q-mt-sm row items-center"
                          style="
                            height: 24px;
                            display: flex;
                            justify-content: space-between;
                          "
                        >
                          <span class="col-sm-auto col-xs-12 q-pl-xs">
                            {{ props.item.nowdate }}
                          </span>
                          <q-btn-group flat>
                            <q-btn
                              flat
                              dense
                              icon="delete_forever"
                              :label="props.item.collection"
                              size="12px"
                              class="q-mr-sm"
                              color="red"
                            >
                              <q-tooltip>删除</q-tooltip>
                            </q-btn>
                            <!-- <q-separator vertical /> -->
                         
                          </q-btn-group>
                        </div>
                      </q-item-section>
                    </q-card-section>
                  </q-card>
                </sc-shadow>
              </div>
            </template>
          </sc-page>
        </q-tab-panel>
      </q-tab-panels>
      <q-dialog v-model="isqrcode">
        <q-card>
          <q-card-section class="row items-center q-pb-none">
            <div class="text-h6">Close icon</div>
            <q-space />
            <q-btn icon="close" flat round dense v-close-popup />
          </q-card-section>

          <q-card-section>
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum
            repellendus sit voluptate voluptas eveniet porro. Rerum blanditiis
            perferendis totam, ea at omnis vel numquam exercitationem aut, natus
            minima, porro labore.
          </q-card-section>
        </q-card>
      </q-dialog>
    </div>
  </div>
</template>

<script>
import ScShadow from 'components/shadow/ScShadow'
import ScPage from 'components/common/ScPage'
import commonUtil from 'src/utils/commonUtil'
import { getLoginData } from '@/utils/localStorage'
import { iwebApi, getCompanyApi, getwxacodeunlimitApi } from '@/api/cardApi'
import { getUdatalistApi, getfollowListApi, opfollowListApi,getfollowsListApi } from '@/api/user'
import { baseUrl, imgUrl, proUrl } from '@/utils/config'

export default {
  name: 'Center',
  components: { ScPage, ScShadow },
  data() {
    return {
      centerTab: 'collect',
      userInfo: {},
      customeruser: [],
      opType: 'collect',
      collectlist: [],
      auditlist:[],
      likeslist: [],
      followlist: [],
      followslist: [],
      readinglist: [],
      pagesize: 0,
      datacount: 0,
      dataindex: 1,
      isqrcode: false
    }
  },
  created() {
    const user = getLoginData()
    let that = this
    if (user == null) {
      that.$router.push('/user/login')
      return
    }
    that.userInfo = user
    let guestcode = user.reguserno
    let gscode = user.gscode
    iwebApi({
      guestcode: guestcode,
      gscode: gscode
    }).then((response) => {
      if (response.code == '0') {
        that.cardInfo = response
        that.logoimg = 'http://img.inheart.cn' + that.cardInfo.logoimg
      } else {
        commonUtil.notifyError('获取卡片信息失败，请重新登录')
        that.$router.push('/user/login')
        return
      }
    })
  },
  computed: {},
  mounted() {
    this.getCompanyData()
    this.getdatalist()
  },
  methods: {
    //初始化获取账套
    getCompanyData() {
      let that = this
      let username = that.userInfo.userName
      getCompanyApi({
        username: username
      }).then((res) => {
        res.data.forEach((element) => {
          if (
            JSON.parse(JSON.stringify(that.userInfo)).company == element.company
          ) {
            that.getuser = element.company
          }
          if (element.logoimg) {
            element.logoimg = 'http://img.inheart.cn' + element.logoimg
          } else {
            element.logoimg =
              'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
          }
        })
        that.customeruser = res.data
      })
    },
    getdatalist() {
      let that = this
      let username = that.userInfo.userName
      getUdatalistApi({
        username: username,
        op_type: that.opType,
        pageindex: that.dataindex,
        pagesize: that.pagesize
      }).then((res) => {
        // console.log(res.data);
        if (res.code == 0 && res.data.length > 0) {
          res.data.forEach((element) => {
            if (element.logoimg) {
              element.logoimg = imgUrl + element.logoimg
            } else {
              element.logoimg =
                'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
            }
          })
          if (that.opType == 'collect') {
            that.collectlist = res.data
          }
          if (that.opType == 'likes') {
            that.likeslist = res.data
          }
          if (that.opType == 'reading') {
            that.readinglist = res.data
          }
           if (that.opType == 'audit') {
            that.readinglist = res.data
          }
           if (that.opType == 'audit') {
            that.auditlist = res.data
          }
          
          that.datacount = res.count
        }
      })
    },
    change(val) {
      let that = this
      that.pagesize = 5
      if (val == 'collect') {
        that.opType = 'collect'
      }
      if (val == 'likes') {
        that.opType = 'likes'
      }
      if (val == 'reading') {
        that.opType = 'reading'
      }
       if (val == 'audit') {
        that.opType = 'audit'
      }
      that.getdatalist()
    },
    getfollows(){
       let that = this
      let username = that.userInfo.userName
      that.opType = 'myfollow'
      that.pagesize = 12
      getfollowsListApi({
         mobile: username,
        op_type: that.opType,
        pageindex: that.dataindex,
        pagesize: that.pagesize
      }).then((res)=>{
          if (res.code == 0 && res.data.length > 0) {
          res.data.forEach((element) => {
            if (element.mdimg != '') {
              element.mdimg =
                imgUrl + element.mdimg.split(',')[0].replace(imgUrl, '')
            } else if (
              element.logoimg != '' &&
              element.logoimg !=
                'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
            ) {
              element.logoimg = imgUrl + element.logoimg.replace(imgUrl, '')
            } else {
              element.logoimg =
                'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
            }
          })
          that.followslist = res.data
          that.datacount = res.count
        }
      })
    },
    getfollow() {
      let that = this
      let username = that.userInfo.userName
      that.opType = 'follow'
      that.pagesize = 12
      getfollowListApi({
        mobile: username,
        op_type: that.opType,
        pageindex: that.dataindex,
        pagesize: that.pagesize
      }).then((res) => {
        if (res.code == 0 && res.data.length > 0) {
          res.data.forEach((element) => {
            if (element.mdimg != '') {
              element.mdimg =
                imgUrl + element.mdimg.split(',')[0].replace(imgUrl, '')
            } else if (
              element.logoimg != '' &&
              element.logoimg !=
                'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
            ) {
              element.logoimg = imgUrl + element.logoimg.replace(imgUrl, '')
            } else {
              element.logoimg =
                'http://www.iqp168.com/src/assets/img/logo240x240.jpg'
            }
          })
          that.followlist = res.data
          that.datacount = res.count
        }
      })
    },
    ChangeCurrentPage(val) {
      let that = this
      that.dataindex = val
      if (
        that.opType == 'collect' ||
        that.opType == 'likes' ||
        that.opType == 'audit' ||
        that.opType == 'reading'
      ) {
        that.getdatalist()
      }
      if (that.opType == 'follow') {
        that.getfollow()
      }
        if (that.opType == 'myfollow') {
        that.getfollows()
      }
    },
    ChangeInputPagePage(val) {
      let that = this
      that.dataindex = val
      if (
        that.opType == 'collect' ||
        that.opType == 'likes' ||
        that.opType == 'audit' ||
        that.opType == 'reading'
      ) {
        that.getdatalist()
      }
      if (that.opType == 'follow') {
        that.getfollow()
      }
        if (that.opType == 'myfollow') {
        that.getfollows()
      }
    },
    getqrcode(val, inforid) {
      let that = this
      let optype = ''
      let guestcode = that.userInfo.reguserno
      let id = inforid
      that.isqrcode = true
      if (val == '产品信息') {
        optype = 'product'
      }
      if (val == '商圈资讯' || val == '商圈合作' || val == '商圈招聘') {
        optype = 'infor'
      }
      if (val == '商家') {
        optype = 'company'
      }
      getwxacodeunlimitApi({
        id: id,
        guestcode: guestcode,
        op_type: optype
      }).then((res) => {})
    },
    opfollow(val) {
      let that = this
      opfollowListApi({
        username: that.userInfo.userName,
        op_type: 'unfollow',
        guestcode: val
      }).then((res) => {
        commonUtil.notifySuccess('取消成功')
        that.getfollow()
      })
    }
  }
}
</script>

<style scoped>
.line {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1 !important;
}
</style>
